AmCharts.AmXYChart=AmCharts.Class({inherits:AmCharts.AmRectangularChart,construct:function(){AmCharts.AmXYChart.base.construct.call(this);this.createEvents("zoomed");this.maxZoomFactor=20;this.chartType="xy"},initChart:function(){AmCharts.AmXYChart.base.initChart.call(this);this.dataChanged&&(this.updateData(),this.dataChanged=!1,this.dispatchDataUpdated=!0);this.updateScrollbar=!0;this.drawChart();this.autoMargins&&!this.marginsUpdated&&(this.marginsUpdated=!0,this.measureMargins());var t=this.marginLeftReal,i=this.marginTopReal,s=this.plotAreaWidth,a=this.plotAreaHeight;this.graphsSet.clipRect(t,i,s,a);this.bulletSet.clipRect(t,i,s,a);this.trendLinesSet.clipRect(t,i,s,a)},createValueAxes:function(){var t=[],i=[];this.xAxes=t;this.yAxes=i;var s=this.valueAxes,a,r;for(r=0;r<s.length;r++){a=s[r];var h=a.position;if("top"==h||"bottom"==h)a.rotate=!0;a.setOrientation(a.rotate);h=a.orientation;"V"==h&&i.push(a);"H"==h&&t.push(a)}0===i.length&&(a=new AmCharts.ValueAxis,a.rotate=!1,a.setOrientation(!1),s.push(a),i.push(a));0===t.length&&(a=new AmCharts.ValueAxis,a.rotate=!0,a.setOrientation(!0),s.push(a),t.push(a));for(r=0;r<s.length;r++)this.processValueAxis(s[r],r);t=this.graphs;for(r=0;r<t.length;r++)this.processGraph(t[r],r)},drawChart:function(){AmCharts.AmXYChart.base.drawChart.call(this);AmCharts.ifArray(this.chartData)?(this.chartScrollbar&&this.updateScrollbars(),this.zoomChart()):this.cleanChart();if(this.hideXScrollbar){var t=this.scrollbarH;t&&(this.removeListener(t,"zoomed",this.handleHSBZoom),t.destroy());this.scrollbarH=null}if(this.hideYScrollbar){if(t=this.scrollbarV)this.removeListener(t,"zoomed",this.handleVSBZoom),t.destroy();this.scrollbarV=null}if(!this.autoMargins||this.marginsUpdated)this.dispDUpd(),this.chartCreated=!0,this.zoomScrollbars()},cleanChart:function(){AmCharts.callMethod("destroy",[this.valueAxes,this.graphs,this.scrollbarV,this.scrollbarH,this.chartCursor])},zoomChart:function(){this.toggleZoomOutButton();this.zoomObjects(this.valueAxes);this.zoomObjects(this.graphs);this.zoomTrendLines();this.dispatchAxisZoom()},toggleZoomOutButton:function(){1==this.heightMultiplier&&1==this.widthMultiplier?this.showZB(!1):this.showZB(!0)},dispatchAxisZoom:function(){var t=this.valueAxes,i;for(i=0;i<t.length;i++){var s=t[i];if(!isNaN(s.min)&&!isNaN(s.max)){var a,r;"V"==s.orientation?(a=s.coordinateToValue(-this.verticalPosition),r=s.coordinateToValue(-this.verticalPosition+this.plotAreaHeight)):(a=s.coordinateToValue(-this.horizontalPosition),r=s.coordinateToValue(-this.horizontalPosition+this.plotAreaWidth));if(!isNaN(a)&&!isNaN(r)){if(a>r){var h=r;r=a;a=h}s.dispatchZoomEvent(a,r)}}}},zoomObjects:function(t){var i=t.length,s;for(s=0;s<i;s++){var a=t[s];this.updateObjectSize(a);a.zoom(0,this.chartData.length-1)}},updateData:function(){this.parseData();var t=this.chartData,i=t.length-1,s=this.graphs,a=this.dataProvider,r=0,h,e;for(h=0;h<s.length;h++)if(e=s[h],e.data=t,e.zoom(0,i),e=e.valueField){var o;for(o=0;o<a.length;o++){var l=a[o][e];l>r&&(r=l)}}for(h=0;h<s.length;h++)e=s[h],e.maxValue=r;if(t=this.chartCursor)t.updateData(),t.type="crosshair",t.valueBalloonsEnabled=!1},zoomOut:function(){this.verticalPosition=this.horizontalPosition=0;this.heightMultiplier=this.widthMultiplier=1;this.zoomChart();this.zoomScrollbars()},processValueAxis:function(t){t.chart=this;t.minMaxField="H"==t.orientation?"x":"y";t.minTemp=NaN;t.maxTemp=NaN;this.listenTo(t,"axisSelfZoomed",this.handleAxisSelfZoom)},processGraph:function(t){t.xAxis||(t.xAxis=this.xAxes[0]);t.yAxis||(t.yAxis=this.yAxes[0])},parseData:function(){AmCharts.AmXYChart.base.parseData.call(this);this.chartData=[];var t=this.dataProvider,i=this.valueAxes,s=this.graphs,a;for(a=0;a<t.length;a++){var r={axes:{},x:{},y:{}},h=t[a],e;for(e=0;e<i.length;e++){var o=i[e].id;r.axes[o]={};r.axes[o].graphs={};var l;for(l=0;l<s.length;l++){var n=s[l],c=n.id;if(n.xAxis.id==o||n.yAxis.id==o){var u={};u.serialDataItem=r;u.index=a;var d={},p=Number(h[n.valueField]);isNaN(p)||(d.value=p);p=Number(h[n.xField]);isNaN(p)||(d.x=p);p=Number(h[n.yField]);isNaN(p)||(d.y=p);p=Number(h[n.errorField]);isNaN(p)||(d.error=p);u.values=d;this.processFields(n,u,h);u.serialDataItem=r;u.graph=n;r.axes[o].graphs[c]=u}}}this.chartData[a]=r}},formatString:function(t,i){var s=i.graph.numberFormatter;s||(s=this.numberFormatter);t=AmCharts.formatValue(t,i.values,["value","x","y"],s);-1!=t.indexOf("[[")&&(t=AmCharts.formatDataContextValue(t,i.dataContext));return t=AmCharts.AmXYChart.base.formatString.call(this,t,i)},addChartScrollbar:function(t){AmCharts.callMethod("destroy",[this.chartScrollbar,this.scrollbarH,this.scrollbarV]);if(t){this.chartScrollbar=t;this.scrollbarHeight=t.scrollbarHeight;var i="backgroundColor backgroundAlpha selectedBackgroundColor selectedBackgroundAlpha scrollDuration resizeEnabled hideResizeGrips scrollbarHeight updateOnReleaseOnly".split(" ");if(!this.hideYScrollbar){var s=new AmCharts.SimpleChartScrollbar;s.skipEvent=!0;s.chart=this;this.listenTo(s,"zoomed",this.handleVSBZoom);AmCharts.copyProperties(t,s,i);s.rotate=!0;this.scrollbarV=s}this.hideXScrollbar||(s=new AmCharts.SimpleChartScrollbar,s.skipEvent=!0,s.chart=this,this.listenTo(s,"zoomed",this.handleHSBZoom),AmCharts.copyProperties(t,s,i),s.rotate=!1,this.scrollbarH=s)}},updateTrendLines:function(){var t=this.trendLines,i;for(i=0;i<t.length;i++){var s=t[i];s.chart=this;s.valueAxis||(s.valueAxis=this.yAxes[0]);s.valueAxisX||(s.valueAxisX=this.xAxes[0])}},updateMargins:function(){AmCharts.AmXYChart.base.updateMargins.call(this);var t=this.scrollbarV;t&&(this.getScrollbarPosition(t,!0,this.yAxes[0].position),this.adjustMargins(t,!0));if(t=this.scrollbarH)this.getScrollbarPosition(t,!1,this.xAxes[0].position),this.adjustMargins(t,!1)},updateScrollbars:function(){var t=this.scrollbarV;t&&(this.updateChartScrollbar(t,!0),t.draw());if(t=this.scrollbarH)this.updateChartScrollbar(t,!1),t.draw()},zoomScrollbars:function(){var t=this.scrollbarH;t&&t.relativeZoom(this.widthMultiplier,-this.horizontalPosition/this.widthMultiplier);(t=this.scrollbarV)&&t.relativeZoom(this.heightMultiplier,-this.verticalPosition/this.heightMultiplier)},fitMultiplier:function(t){t>this.maxZoomFactor&&(t=this.maxZoomFactor);return t},handleHSBZoom:function(t){var i=this.fitMultiplier(t.multiplier);t=-t.position*i;var s=-(this.plotAreaWidth*i-this.plotAreaWidth);t<s&&(t=s);this.widthMultiplier=i;this.horizontalPosition=t;this.zoomChart()},handleVSBZoom:function(t){var i=this.fitMultiplier(t.multiplier);t=-t.position*i;var s=-(this.plotAreaHeight*i-this.plotAreaHeight);t<s&&(t=s);this.heightMultiplier=i;this.verticalPosition=t;this.zoomChart()},handleAxisSelfZoom:function(t){if("H"==t.valueAxis.orientation){var i=this.fitMultiplier(t.multiplier);t=-t.position*i;var s=-(this.plotAreaWidth*i-this.plotAreaWidth);t<s&&(t=s);this.horizontalPosition=t;this.widthMultiplier=i}else i=this.fitMultiplier(t.multiplier),t=-t.position*i,s=-(this.plotAreaHeight*i-this.plotAreaHeight),t<s&&(t=s),this.verticalPosition=t,this.heightMultiplier=i;this.zoomChart();i=this.graphs;for(t=0;t<i.length;t++)i[t].setAnimationPlayed();this.zoomScrollbars()},handleCursorZoom:function(t){var i=this.widthMultiplier*this.plotAreaWidth/t.selectionWidth,s=this.heightMultiplier*this.plotAreaHeight/t.selectionHeight,i=this.fitMultiplier(i),s=this.fitMultiplier(s);this.horizontalPosition=(this.horizontalPosition-t.selectionX)*i/this.widthMultiplier;this.verticalPosition=(this.verticalPosition-t.selectionY)*s/this.heightMultiplier;this.widthMultiplier=i;this.heightMultiplier=s;this.zoomChart();this.zoomScrollbars()},removeChartScrollbar:function(){AmCharts.callMethod("destroy",[this.scrollbarH,this.scrollbarV]);this.scrollbarV=this.scrollbarH=null},handleReleaseOutside:function(t){AmCharts.AmXYChart.base.handleReleaseOutside.call(this,t);AmCharts.callMethod("handleReleaseOutside",[this.scrollbarH,this.scrollbarV])}});
//# sourceMappingURL=xy.map.js